﻿@using VideoSeller.Business.Data.Enums
@model ContentListFilterViewModel

@if (!Model.HideFilterControls) {
	<div style="float: right; position: relative; top: -60px;">
		<input id="search" type="text" value="@(Model.Filter != null ? Model.Filter.Search : string.Empty)"/>&nbsp;<img id="searchButton" src="@Url.Content("~/Content/images/search_button.png")" alt="Search" style="position: relative; cursor: pointer;"/>
	</div>
	<div class="ui-helper-clearfix"></div>
}

<div style="text-align: right; position: relative; top: -20px;">
	@if (!Model.HideFilterControls) {
	<a href="@Url.Action(Model.Action, Model.Controller, new {filterType = Model.CurrentFilter == ContentListFilterType.TimeDesc ? ContentListFilterType.TimeAsc : ContentListFilterType.TimeDesc})">@if (Model.CurrentFilter == ContentListFilterType.TimeDesc){<img alt="@Html.GetGlobalResource("ContentList", "TimeDesc")" src="@Url.Content("~/Content/images/time-down.png")"/>}@if(Model.CurrentFilter == ContentListFilterType.TimeAsc){<img alt="@Html.GetGlobalResource("ContentList", "TimeAsc")" src="@Url.Content("~/Content/images/time-up.png")"/>}@if((Model.CurrentFilter != ContentListFilterType.TimeAsc)&&(Model.CurrentFilter != ContentListFilterType.TimeDesc)){<img alt="time default" src="@Url.Content("~/Content/images/time.png")"/>}</a>
     
     if (Model.ShowMarkedFilter) {<a href="@Url.Action(Model.Action, Model.Controller, new {filterType = ContentListFilterType.Marked})">@if(Model.CurrentFilter == ContentListFilterType.Marked){<img alt="@Html.GetGlobalResource("ContentList", "Marked")" src="@Url.Content("~/Content/images/marked-on.png")"/>}else{<img alt="@Html.GetGlobalResource("ContentList", "Marked")" src="@Url.Content("~/Content/images/marked-off.png")"/>}</a>}
                                                                                                                                                                                                                                                                                             
                                                                                                                                                                                                                                                                                             
		<a href="@Url.Action(Model.Action, Model.Controller, new {filterType = ContentListFilterType.All})" @(Model.CurrentFilter == ContentListFilterType.All ? "class=selected-filter" : string.Empty)><img alt="@Html.GetGlobalResource("ContentList", "All")" src="@Url.Content("~/Content/images/all.png")" /></a><text>&nbsp;&nbsp;</text><img alt="filter" src="@Url.Content("~/Content/images/filters.png")" onclick="$('#filter-online-content').dialog('open');" style="position: relative; cursor: pointer;"/>
	}

	@if (Model.HasSelected) {
		<div style="float: left;">
			<div class="price_filter">@Model.PriceFilter.ToString()</div>
            @if (Model.SelectedCountry.HasValue)
            {
                <div class ="country_filter">@Model.SelectedCountryName</div>
            }
			<div class="lang w210">
				@foreach (var language in Model.SelectedLanguages) {
					if (language == "en-US") {
						<a href="javascript:void(0);" class="uk active"></a>
					}
					else if (language == "de-DE") {
						<a href="javascript:void(0);" class="de active"></a>
					}
					else if (language == "fr-FR") {
						<a href="javascript:void(0);" class="fr active"></a>
					}
					else if (language == "it-IT") {
						<a href="javascript:void(0);" class="ita active"></a>
					}
					else if (language == "es-ES") {
						<a href="javascript:void(0);" class="spn active"></a>
					}
					else if (language == "ru-RU") {
						<a href="javascript:void(0);" class="ru active"></a>
					}
					else if (language == "zh-CN") {
						<a href="javascript:void(0);" class="zh active"></a>
					}
				}
			</div>
			<div class="lang filter_categories">
				@foreach (var category in Model.SelectedCategories) {
					<label>@category.Title &nbsp;</label>
				}
			</div>
			<div class="lang filter_videotype">
				@if (!string.IsNullOrEmpty(Model.Filter.Author)) {
					<label>Author: @Model.Filter.Author</label>
				}
				@if (Model.Filter.VideoType.HasValue) {
					switch (Model.Filter.VideoType.Value) {
						case VideoContentType.Free:
							<img src="@Url.Content("~/Content/images/video_type_my_16.png")" alt="My"/>
							break;
						case VideoContentType.Paid:
							<img src="@Url.Content("~/Content/images/video_type_conference_16.png")" alt="Conference"/>
							break;
						case VideoContentType.PaidGroups:
							<img src="@Url.Content("~/Content/images/video_type_meeting_16.png")" alt="Meeting"/>
							break;
					}
				}
			</div>
		</div>
	}
</div>
<div class="ui-helper-clearfix"></div>
@if (!Model.HideFilterControls) {
	<div id="filter-online-content" style="display:none;" title="@Html.GetGlobalResource("ContentList", "FilterContentItems")">
		<form>
            <table class="filters_select">
            <tr>
                <td>
                    <h3>@Html.GetGlobalResource("ContentList", "Languages")</h3>
                    <div class="lang w240">
                        <a id="en-US" href="javascript:void(0);" class="@(string.Concat("uk ", Model.SelectedLanguages.Contains("en-US") ? "active" : string.Empty))"></a>
                        <a id="de-DE" href="javascript:void(0);" class="@(string.Concat("de ", Model.SelectedLanguages.Contains("de-DE") ? "active" : string.Empty))"></a>
                        <a id="fr-FR" href="javascript:void(0);" class="@(string.Concat("fr ", Model.SelectedLanguages.Contains("fr-FR") ? "active" : string.Empty))"></a>
                        <a id="it-IT" href="javascript:void(0);" class="@(string.Concat("ita ", Model.SelectedLanguages.Contains("it-IT") ? "active" : string.Empty))"></a>
                        <a id="es-ES" href="javascript:void(0);" class="@(string.Concat("spn ", Model.SelectedLanguages.Contains("es-ES") ? "active" : string.Empty))"></a>
                        <a id="ru-RU" href="javascript:void(0);" class="@(string.Concat("ru ", Model.SelectedLanguages.Contains("ru-RU") ? "active" : string.Empty))"></a>
                        <a id="zh-CN" href="javascript:void(0);" class="@(string.Concat("zh ", Model.SelectedLanguages.Contains("zh-CN") ? "active" : string.Empty))"></a>
                    </div>
                </td>
                <td>
                    		<h3>@Html.GetGlobalResource("OnlineWizard", "Country")</h3>
		<select id="SelectedCountry" style="width:250px;" class="wz_s1_sl_country"  >
				<option value="null" @(Model.SelectedCountry == null ? "selected=\"selected\"" : string.Empty)>@Html.GetGlobalResource("ContentList", "TypeVideoAll")</option>

			@foreach (var item in Model.countryes) {
				<option value="@item.Id"  @(Model.SelectedCountry == item.Id ? "selected=\"selected\"" : string.Empty)>@item.Name</option>
			}
		</select>

                </td>
                </tr>
                <tr>
                    <td>
                   <h3>@Html.GetGlobalResource("ContentList", "PriceFilter")</h3>
                <select id="priceFilterList">
                    <option value="null" @(Model.PriceFilter == PriceFilter.All ? "selected=\"selected\"" : string.Empty)>@Html.GetGlobalResource("ContentList", "PriceFilterAll")</option>
                    <option value="@PriceFilter.Free" @(Model.PriceFilter == PriceFilter.Free ? "selected=\"selected\"" : string.Empty)>@Html.GetGlobalResource("ContentList", "PriceFilterFree")</option>
                    <option value="@PriceFilter.Paid" @(Model.PriceFilter == PriceFilter.Paid ? "selected=\"selected\"" : string.Empty)>@Html.GetGlobalResource("ContentList", "PriceFilterPaid")</option>
                </select>

                    </td>
                <td>
                    <h3>@Html.GetGlobalResource("ContentList", "TypeVideo")</h3>
                    <select id="videoTypeFilterList">
                        <option value="">@Html.GetGlobalResource("ContentList", "TypeVideoAll")</option>
                        <option value="@VideoContentType.Free" @(Model.VideoTypeFilter == VideoContentType.Free ? "selected=\"selected\"" : string.Empty)>@Html.GetGlobalResource("ContentList", "TypeVideoMy")</option>
                        <option value="@VideoContentType.Paid" @(Model.VideoTypeFilter == VideoContentType.Paid ? "selected=\"selected\"" : string.Empty)>@Html.GetGlobalResource("ContentList", "TypeVideoConference")</option>
                        <option value="@VideoContentType.PaidGroups" @(Model.VideoTypeFilter == VideoContentType.PaidGroups ? "selected=\"selected\"" : string.Empty)>@Html.GetGlobalResource("ContentList", "TypeVideoMeeting")</option>
                    </select>
                </td>
                </tr>
                </table>
            <br />
            <div>
                <h3>@Html.GetGlobalResource("ContentList", "Categories")</h3>
                <ul>
                @foreach (var category in Model.Categories)
                {
                    <li class="categories_list">
                        <div class="cat_title">
                            <div class="chk">
                                 <input id="category_@category.Id" data-cat="@category.Id" type="checkbox" name="Category" @(Model.SelectedCategories.Any(x => x.Id == category.Id) ? "checked='checked'" : string.Empty) />
                            </div>
                            <div class="name">
                                <label for="category_@category.Id">@category.Title</label></div>
                        </div>
                        <img src="@category.ImageUrl"/>
                        <br />
                        <br />
                    </li>
            
            @*
                    
                    <div style="float: left;" class="online-categories">
                        <input id="category_@category.Id" data-cat="@category.Id" type="checkbox" name="Category" @(Model.SelectedCategories.Any(x => x.Id == category.Id) ? "checked='checked'" : string.Empty) />
                        <label for="category_@category.Id">@category.Title</label>
                        <br />
                        <img src="@category.ImageUrl"/>
                        <br />
                    </div>*@
                }
                    </ul>
            </div>
		</form>
	</div>
	@Html.Hidden("actionmethod", Url.Action(Model.Action, Model.Controller, new {page = Model.PageNumber, pageSize = Model.PageSize}))
}